﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WinFormsAppTest.Class;
using WinFormsAppTest.pojo;

namespace WinFormsAppTest
{
    internal class UserService
    {
        public int FindIsUser(String uname,String upassword)
        {
            TestDao userdao = new TestDao();
            if(userdao.FindIsUser(uname,upassword) !=0)
            {
                int id = userdao.FindIsUser(uname, upassword);
                //MessageBox.Show("登录成功！");
                return id;
            }
            else
            {
                //MessageBox.Show("登录失败！");
                return 0;
            }
        }

        public List<Class.Files> GetUserFiles( int id)
        {
            TestDao userdao = new TestDao();
            List<Class.Files> files = userdao.GetUserFilesById(id);
            return files;
        }

        public List<WinFormsAppTest.pojo.Change> GetUserChange(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Change> change = userdao.GetUserChangeById(id);
            return change;
        }

        public List<WinFormsAppTest.pojo.Exam> GetUserExam(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Exam> exam = userdao.GetUserExamById(id);
            return exam;
        }

        public List<WinFormsAppTest.pojo.Work> GetUserWork(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Work> work = userdao.GetUserWorkById(id);
            return work;
        }

        public List<WinFormsAppTest.pojo.Signs> GetUserSigns(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Signs> signs = userdao.GetUserSignsById(id);
            return signs;
        }

        public List<WinFormsAppTest.pojo.Overtime> GetUserOvertime(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Overtime> overtime = userdao.GetUserOvertimeById(id);
            return overtime;
        }

        public List<WinFormsAppTest.pojo.Outtime> GetUserOuttime(int id)
        {
            TestDao userdao = new TestDao();
            List<WinFormsAppTest.pojo.Outtime> outtime = userdao.GetUserOuttimeById(id);
            return outtime;
        }


    }
}
